package util

import (
	evm "chainmaker.org/chainmaker/common/v2/evmutils"
)

func getContractAddress(name string) (*evm.Address, error) {
	bigInt, err := evm.MakeAddressFromString(name)
	addr := evm.BigToAddress(bigInt)
	return &addr, err
}

// GetContractAddressByName get contract address
func GetContractAddressByName(name string) (string, error) {
	outAddr, err := getContractAddress(name)
	if err != nil {
		return "", err
	}
	return outAddr.String(), nil
}
